# type和isinstance判断类型
def foo():
    print(1)
print(type(abs))
print(type(foo))
print(isinstance(1,int))
# dir打印对象上所有属性
# print(dir(1))


# getattr()、setattr()以及hasattr()
class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

p1 = Person("Alice", 30)
print(getattr(p1,"age"))
setattr(p1,"age",18)
print(getattr(p1,"age"))
print(getattr(p1,"ccc","获取ccc的默认值"))
print(hasattr(p1,"aaa"))

print(hasattr(1,"aaa"))

